package com.woniu.dao;

import com.woniu.pojo.ServiceOrderdto;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface ServiceOrderdtoMapper {
    @Select("select so.id,so.starttime,so.endtime,ps.payname,ps.payprice,ps.icon,so.ordername,so.ordernumber,so.ordertype  FROM service_order so,pp_payservice ps where so.serviceid=ps.id and so.id=#{value}")
    ServiceOrderdto selectServiceOrderdtoById(Integer id);

    @Select("select ps.payname,ps.payprice,ps.icon,sx.id,sx.starttime,sx.endtime,sx.ordernumber  from pp_payservice ps,service_order sx,person_user pu where ps.id=sx.serviceid and pu.id=sx.userid and sx.`status`=0 and pu.id=#{value}")
    List<ServiceOrderdto> selectspokeByuserid(Integer userid);

    @Select("select ps.payname,ps.payprice,ps.icon,sx.id,sx.starttime,sx.endtime,sx.ordernumber  from pp_payservice ps,service_order sx,person_user pu where ps.id=sx.serviceid and pu.id=sx.userid and sx.`status`=1 and pu.id=#{value}")
    List<ServiceOrderdto> selectattendByuserId(Integer userid);

    @Select("select ps.payname,ps.payprice,ps.icon,sx.id,sx.starttime,sx.endtime,sx.ordernumber  from pp_payservice ps,service_order sx,person_user pu where ps.id=sx.serviceid and pu.id=sx.userid and sx.`status`=2 and pu.id=#{value}")
    List<ServiceOrderdto> selectcompletByuserId(Integer userid);

    @Select("select ps.payname,ps.payprice,ps.icon,sx.id,sx.starttime,sx.endtime,sx.ordernumber  from pp_payservice ps,service_order sx,person_user pu where ps.id=sx.serviceid and pu.id=sx.userid and sx.`status`=3 and pu.id=#{value}")
    List<ServiceOrderdto> selectreturnByuserId(Integer userid);

    @Select("select ps.payname,ps.payprice,ps.icon,sx.id,sx.starttime,sx.endtime,sx.ordernumber  from pp_payservice ps,service_order sx,person_user pu where ps.id=sx.serviceid and pu.id=sx.userid and sx.`status`=4 and pu.id=#{value}")
    List<ServiceOrderdto> selectwaitByuserId(Integer userid);

    @Select("select ps.payname,ps.payprice,ps.icon,sx.id,sx.starttime,sx.endtime,sx.ordernumber  from pp_payservice ps,service_order sx,person_user pu where ps.id=sx.serviceid and pu.id=sx.userid and sx.`status`=5 and pu.id=#{value}")
    List<ServiceOrderdto> selectwaitpayByuserId(Integer userid);

    @Select("select ps.payname,ps.payprice,ps.icon,sx.id,sx.starttime,sx.endtime,sx.ordernumber  from pp_payservice ps,service_order sx,person_user pu where ps.id=sx.serviceid and pu.id=sx.userid and sx.`status`=6 and pu.id=#{value}")
    List<ServiceOrderdto> selectstateByuserId(Integer userid);

    @Select("select ps.payname,ps.payprice,ps.icon,sx.id,sx.starttime,sx.endtime,sx.ordernumber  from pp_payservice ps,service_order sx,person_user pu where ps.id=sx.serviceid and pu.id=sx.userid and sx.`status`=7 and pu.id=#{value}")
    List<ServiceOrderdto> selectrefuseByuserId(Integer userid);
}
